package com.example.myapplication2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.view.View;
public class Main2Activity extends Activity
{
    EditText address;
    EditText content;
    Button send;
    Button bn5;
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        bn5= findViewById(R.id.bn5);
        bn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Main2Activity.this,Main3Activity.class);
                startActivity(intent);
            }

        });
        // 获取应用程序中的bn按钮
        Button bn =  findViewById(R.id.bn1);
        // 为按钮绑定事件监听器。
        bn.setOnClickListener(new MyClickListener());
        // 获取页面中收件人地址、短信内容
        address = findViewById(R.id.address);
        content = findViewById(R.id.content);
        send = (Button)findViewById(R.id.send);
        bn.setOnLongClickListener(new SendSmsListener(
                this , address, content));
    }

    // 定义一个单击事件的监听器
    class MyClickListener implements View.OnClickListener
    {
        // 实现监听器类必须实现的方法，该方法将会作为事件处理器
        @Override
        public void onClick(View v)
        {
            EditText txt = (EditText) findViewById(R.id.txt);
            txt.setText("点击了采用内部类的监听器");
        }
    }

}
